<?php 

/**
 * @todo set selected menu
 * 
 **/

require_once('config.php'); 
//////////////////////////////////////////////////////////////////
/**
* @todo submit action for contactus page
* 
**/
// $to = "ahmed_elfaris@yahoo.com";
// $subject = "Test mail";
// $message = "Hello! This is a simple email message.";
// // Always set content-type when sending HTML email
// $headers = "MIME-Version: 1.0" . "\r\n";
// $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
// //More headers
// $headers .= 'From: <a.developer@hotmail.com>' . "\r\n";
// $headers .= 'Cc: a.developer@hotmail.com' . "\r\n";
// echo mail($to,$subject,$message,$headers);

if(isset($_POST['submit']))
{
    $contactName= $_POST['ContactName'];
    $companyName= $_POST['CompanyName'];
    $email= $_POST['Email'];
    $phone= $_POST['Phone'];
    $category= $_POST['Category'];
    $websiteURL= $_POST['WebsiteURL'];
    $desc= $_POST['Desc'];
    
	$to = "webmaster2fci@gmail.com";
	$subject = "Developer4Me";
	$message = "<h1>Contact Person Details:</h1> 
						  <br/> Name: $contactName 
						   <br/>Company Name:$companyName
						   <br/>Email: $email
						   <br/>Phone:$phone
						   <br/>Project Category:$category
						   <br/>Client Website:$websiteURL
						   <br/>Description:$desc";
	$headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";			   
	$headers .= 'From: <webmaster@example.com>' . "\r\n" ;
          
     //$sql = "INSERT INTO users (id,name,email,mobile,birthday,ref_id,fb_id)
    //VALUES (null, '$name', '$email', '$mobile','$birthday',$referral_id,'');";
    $page_container = '';
	if (function_exists('mail')){
		//echo 'mail() is available';
		// echo $to .":".$subject.":".$message;
		// echo mail($to, $subject,$message,$headers);
		if(mail($to, $subject,$message,$headers)){
			
			$page_container = "<div><p style='text-align:center;'><h3> Your Request has been sent successfully. <br/> And We will contact you as soon as possible. </h3>
			<img src='images/thank.jpg' /></p></div>";
		}
	} else {
		$page_container='Sorry , mail() has been disabled';
	}   
 ////////////////////////////////////////////////////////////////////////   
/**
* @todo set rightside of contact Us page
* 
**/   	
$tpl['content']= $page_container; 
include(TPL.'./layout.php');      
exit();
}
$tpl['title']="Contact Us | PHP Web Applications freelancer";


include(TPL.'./contact.php');
?>